from behavioral.observer.Data import Data
from behavioral.observer.DecimalViewer import DecimalViewer
from behavioral.observer.HexViewer import HexViewer


def main():
    data1 = Data('Data 1')
    data2 = Data('Data 2')
    view1 = DecimalViewer()
    view2 = HexViewer()

    data1.attach(view1)
    data1.attach(view2)

    data2.attach(view1)
    data2.attach(view2)

    print('Setting Data 1 = 10')
    data1.data = 10

    print('Setting Data 2 = 15')
    data1.data = 15
    print("Setting Data 1 = 3")
    data1.data = 3
    print("Setting Data 2 = 5")
    data2.data = 5
    print("Detach HexViewer from data1 and data2.")
    data1.detach(view2)
    data2.detach(view2)
    print("Setting Data 1 = 10")
    data1.data = 10
    print("Setting Data 2 = 15")
    data2.data = 15


if __name__ == '__main__':
    main()
